<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="rain">下雨</button>
    <button id="girl">女孩</button>
    <img src="./images/rain.jpg" alt="" title="下雨">
    <script>
        var rain = document.getElementById('rain');
        var girl = document.getElementById('girl');
        var img = document.querySelector('img');
        girl.onclick = function(){
            img.src = './images/girl.jpg';
            img.title = '女孩';
        }
        rain.onclick = function(){
            img.src='./images/rain.jpg';
            img.title="下雨";
        }
    </script>
</body>
</html>